Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ITelemetryActivator with ITelemetryModule #3009

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

bachuv
Copy link
Collaborator

@bachuv bachuv commented Jan 14, 2025

This PR replaces ITelemetryActivator with ITelemetryModule so we can have more flexibility with configuration. For example, with this change we can set Managed Identity credentials instead of only setting Application Insights relevant settings.

For context:

  • ITelemetryActivator: Used to activate or create telemetry objects. It also initializes the telemetry client for distributed tracing, allowing settings to be verified and adjusted during initialization
  • ITelemetryModule: Used to initialize and configure telemetry modules from TelemetryConfiguration. It ensures that telemetry modules are properly set up to collect and send data using the same configuration.

Also, in this PR, we remove some log statements and checks. With ITelemetryActivator, we checked if the customer was providing APPINSIGHTS_INSTRUMENTATIONKEY and/or APPLICATIONINSIGHTS_CONNECTION_STRING and logged different warnings based on the configuration. With ITelemetryModule, it automatically has the configuration in the TelemetryConfiguration object, so we no longer need to check for these configurations.

Resolves #2870

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation PR is ready to merge and referenced in pending_docs.md
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • I have added all required tests (Unit tests, E2E tests)
  • My changes do not require any extra work to be leveraged by OutOfProc SDKs
    • Otherwise: That work is being tracked here: #issue_or_pr_in_each_sdk
  • My changes do not change the version of the WebJobs.Extensions.DurableTask package
    • Otherwise: major or minor version updates are reflected in /src/Worker.Extensions.DurableTask/AssemblyInfo.cs
  • My changes do not add EventIds to our EventSource logs
    • Otherwise: Ensure the EventIds are within the supported range in our existing Windows infrastructure. You may validate this with a deployed app's telemetry. You may also extend the range by completing a PR such as this one.
  • My changes should be added to v3.x branch.
    • Otherwise: This change only applies to Durable Functions v2.x and will not be merged to branch v3.x.

@cgillum cgillum requested a review from jviau January 15, 2025 00:08
@jviau
Copy link
Contributor

jviau commented Jan 15, 2025

This looks good to me overall. But is it possible to add some unit tests for the Initialize method? Also, have you verified this works manually? That initialize is called and durable tracing is configured?

Also are all the failing builds of concern or transient?

@@ -89,7 +90,7 @@ public static ITestHost CreateJobHost(

if (onSend != null)
{
serviceCollection.AddSingleton<ITelemetryActivator>(serviceProvider =>
serviceCollection.AddSingleton<ITelemetryModule>(serviceProvider =>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jviau - after updating this line to register an ITelemetryModule for tests, I noticed that the lambda expression here doesn't get evaluated anymore and therefore the TelemetryActivators constructor and Intialize() method don't get called. I thought it was because the new Initialize() method takes a TelemetryConfiguration as an argument so I registered a TelemetryConfiguration as a singleton before line 91, but it's still not initializing TelemetryActivator. Do you know if there are any additional services I should register to get TelemetryActivator to register?

For context, the changes in this PR work when I manually test them in a sample DF app. The tests are just not passing because of the issue I described earlier.

@bachuv
Copy link
Collaborator Author

bachuv commented Jan 29, 2025

This looks good to me overall. But is it possible to add some unit tests for the Initialize method? Also, have you verified this works manually? That initialize is called and durable tracing is configured?

Also are all the failing builds of concern or transient?

I'm working on adding unit tests for the Initialize method. I verified that this works manually.

The failing build includes some existing tests that are failing now because of the changes so I'm looking into that. I left a comment in the PR that explains the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Durable Tracing V2 issue when using Application Insights with Entra Authentication
2 participants